<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="lib/html5.js"></script>
	<script type="text/javascript" src="lib/respond.min.js"></script>
	<script type="text/javascript" src="lib/PIE_IE678.js"></script>
	<![endif]-->
	<link href="__PUBLIC__/css/H-ui.min.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
	<link href="Tpl/Admin/common/form.css" rel="stylesheet" type="text/css" />
	<!--[if IE 6]>
	<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>数据字典</title>
</head>
<body>
	<nav class="breadcrumb"> <i class="Hui-iconfont">&#xe67f;</i>
		系统管理
		<span class="c-gray en">&gt;</span>
		数据字典
		<span class="c-gray en">&gt;</span>
		数据字典列表
		<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" > <i class="Hui-iconfont">&#xe68f;</i>
		</a>
	</nav>
	<div class="pd-20">
		<!-- <div class="text-c"> 日期范围：
			<input type="text" onfocus="WdatePicker()" id="datemin" class="input-text Wdate" style="width:120px;">
			-
			<input type="text" onfocus="WdatePicker()" id="datemax" class="input-text Wdate" style="width:120px;">
			<input type="text" class="input-text" style="width:250px" placeholder="输入小区名称或地址" id="" name="">
			<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜小区</button>
		</div> -->
		<div class="text-c">
			<form action="" method="POST">
				<input type="text" class="input-text" style="width:250px" placeholder="输入关键字模糊搜索" id="searchName" name="keyword">
				<button type="submit" class="btn btn-success radius searchButton" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>

			</form>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l">
				<a href="javascript:;" class="btn btn-danger radius dictDelBat">
					<i class="Hui-iconfont">&#xe6e2;</i>
					批量删除
				</a>
				<a href="javascript:;" onclick="dict_add('添加字典','{:U('Dict/create')}','500','400')" class="btn btn-primary radius">
					<i class="Hui-iconfont">&#xe600;</i>
					添加字典
				</a>
			</span>
			<!-- <span class="r">
				共有数据： <strong>54</strong>
				条
			</span> -->
		</div>
		<table class="table table-border table-bordered table-bg" id="dictTable">
			<thead>
				<tr>
					<th scope="col" colspan="8">字典列表</th>
				</tr>
				<tr class="text-c">
					<th width="25">
						<input type="checkbox" name="" value="">
					</th>
					<th width="40">字段ID</th>
					<th width="200">标题</th>
					<th width="100">类型</th>
					<th width="200">文本</th>
					<th width="50">值</th>
					<th width="50">排序号</th>
					<th width="100">操作</th>
				</tr>
			</thead>
			<tbody class="perTableTbody">
				<tr class="text-c">
					<td>
						<input type="checkbox" value="1" name=""></td>
					<td>1</td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td>
						<a title="编辑" href="javascript:;" class="ml-5" style="text-decoration:none">
							<i class="Hui-iconfont">&#xe6df;</i>
						</a>
						<a title="删除" href="javascript:;" onclick="admin_permission_del(this,'1')" class="ml-5" style="text-decoration:none">
							<i class="Hui-iconfont">&#xe6e2;</i>
						</a>
					</td>
				</tr>
			</tbody>
		</table>
		
	</div>
	<script type="text/javascript" src="__PUBLIC__/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/H-ui.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/H-ui.admin.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="Tpl/Admin/common/dict/table.js"></script>
	<script type="text/javascript">
		

//权限复选框
// $(document).on("click",".perTableTbody checkbox");

/*
参数解释：
title	标题
url		请求的url
id		需要操作的数据id
w		弹出层宽度（缺省调默认值）
h		弹出层高度（缺省调默认值）
*/
/*客户添加*/
function dict_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*管理员-权限-编辑*/
$(document).on("click",".dictEdit",function(){
	var id=$(this).attr("uid");
	layer.open({
		type: 2,
		area: ['500px', '400px'],
		fix: false, //不固定
		maxmin: true,
		shade:0.4,
		title: "权限编辑",
		content:'/index.php?m=Admin&c=Dict&a=modify'+'&id='+id,
	});
});

/*管理员-权限-删除*/
$(document).on("click",".dictDel",function(e){
	
	var id=$(this).attr("uid");
	layer.confirm('确定删除该权限节点么？',function(index){
		// console.log(e);
		perDel(id);
	});
});


// 管理员-权限-批量删除
$(document).on("click",".dictDelBat",function(e){
		id=[];
		var dictName="";
		$("input[name='dict_id']:checked").each(function(){
			id.push($(this).val());
			 dictName+=$(this).val()+',';
		});
		dictName='你确定删除id为：'+dictName+'的权限么？';
		layer.confirm(dictName,function(){
			perDel(id);
			
		});

});

// 删除函数
function perDel(id){
	$.post("/index.php?m=Admin&c=Dict&a=delete",{id:id.toString()},function(data){
		var table=$("#dictTable");
		console.log(id);
		if(data){
				if(typeof(id)=='string'){
					table.DataTable().row($(".uid-"+id).parents('tr')).remove().draw(false);
				}else{
					for(var i=0;i<id.length;i++){
						console.log('delete');
						table.DataTable().row($(".uid-"+id[i]).parents('tr')).remove().draw(false);
					}
				}
			
			layer.msg('已删除!',{icon:1,time:1000});
		}else{
			layer.msg('删除失败!',{icon:1,time:1000});
		}
	});
}
</script>
</body>
</html>